package huadi.concurrent.atomic;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * Created with IntelliJ IDEA.
 * User: zhufeng.hd
 * Date: 12-7-17
 * Time: 下午4:48
 */
public class Atomic extends Thread {
    private AtomicCounter counter;

    public Atomic(AtomicCounter c) {
        this.counter = c;
    }

    public void run() {
        counter.increment();
    }


    public static void main(String[] args) {
        AtomicInteger counter = new AtomicInteger(0);
        Atomic1 ato1 = new Atomic1(counter);
        Atomic atoThread = new Atomic(ato1);
        atoThread.start();
    }
}

